﻿@model DslamPort.Models.DslamModel
<div class="container_12">
    <div class="grid_12">
        <div class="module">
            <h2 align="right">
                <span><a href="@Url.Action("Index", "GPON")">Quay lại</a></span></h2>
            <div class="module-body">
                @using (Html.BeginForm("AddDslam", "GPON", FormMethod.Post, new { id = "AddDslam" }))
                {                      
                    <div align="center">
                        <h3>
                            THÊM MỚI GPON</h3>
                        <div class="account" align="center">
                            <img src="@Url.Content("~/Content/Body/Images/Body_Images/Add_Device.png")" width="12%" />
                        </div>
                    </div>
                    if (TempData["msg"] != null)
                    {                            
                    <span class="notification n-error">@TempData["msg"]</span>
                    }  
                    <p>
                    </p>
                    <p style="width: 25%; float: left">
                    </p>
                    <div style="width: 50%; text-align: center; float: left">
                        <p align="center">
                            <label style="width: 55%; text-align: left;">
                                System id:</label>
                            <div class="system_id" align="center" style="padding-left: 10px; width: 100%">
                                @Html.TextBoxFor(model => model.system_id, new { @name = "system_id", @class = "input-medium" })
                                <font color="red">(*)</font>
                                <label style="width: 60%; text-align: left">
                                    @Html.ValidationMessageFor(model => model.system_id)
                                </label>
                            </div>
                        </p>
                        <p align="center">
                            <label style="width: 55%; text-align: left;">
                                Tên Dslam:</label>
                            <div class="name" align="center" style="padding-left: 10px; width: 100%">
                                @Html.TextBoxFor(model => model.name, new { @name = "name", @class = "input-medium" })
                                <font color="red">(*)</font>
                                <label style="width: 60%; text-align: left">
                                    @Html.ValidationMessageFor(model => model.name)
                                </label>
                            </div>
                        </p>                        
                        <p align="center" style="padding-left: 11px; width: 100%">
                            <label style="width: 60.8%; text-align: left;">
                                Đơn vị:</label>
                            @if (ViewBag.donvi != null)
                            {                               
                                @Html.DropDownList("quan_huyen_id", ViewBag.donvi as SelectList, "---Chọn đơn vị---")   
                            
                            }
                            <font color="red">(*)</font>
                            <label style="width: 60%; text-align: left;">
                                @Html.ValidationMessageFor(model => model.quan_huyen_id)
                            </label>
                        </p>

                         <p align="center" style="padding-left: 11px; width: 100%">
                            <label style="width: 60.8%; text-align: left;">
                                Khu Vực:</label>
                            @if (ViewBag.xa_phuong_id == null)
                            {    
                    @Html.DropDownList("xa_phuong_id", Enumerable.Empty<SelectListItem>(), "---Chọn Khu vực---")
                            }
                            else
                            {
                    @Html.DropDownList("xa_phuong_id", ViewBag.xa_phuong_id as SelectList, "---Chọn khu vực---")
                            }
                            <font color="red">(*)</font>
                            <label style="width: 60%; text-align: left;">
                                @Html.ValidationMessageFor(model => model.xa_phuong_id)
                            </label>
                        </p>
                        <p align="center" style="padding-left: 11px; width: 100%">
                            <label style="width: 60.8%; text-align: left;">
                                Tổ Dân Phố:</label>
                           @if (ViewBag.todanpho == null)
                {    
                    @Html.DropDownList("todanpho_id", Enumerable.Empty<SelectListItem>(), "---Chọn Tổ dân phố---")
                }
                else
                {
                    @Html.DropDownList("todanpho_id", ViewBag.todanpho as SelectList, "---Chọn Tổ dân phố---")
                }
                           
                             <font color="red">(*)</font>
                                <label style="width: 60%; text-align: left">
                                    @Html.ValidationMessageFor(model => model.todanpho_id)
                                </label>
                            
                        </p>


                        <p align="center" style="padding-left: 11px; width: 100%">
                            <label style="width: 60.8%; text-align: left;">
                                Loại Dslam:</label>
                            @if (ViewBag.dslam_type != null)
                            {                               
                                @Html.DropDownList("dslam_type_id", ViewBag.dslam_type as SelectList, "---Loại Dslam---")   
                            
                            }
                            <font color="red">(*)</font>
                            <label style="width: 60%; text-align: left;">
                                @Html.ValidationMessageFor(model => model.dslam_type_id)
                            </label>
                        </p>        
                        <p align="center">
                            <label style="width: 55%; text-align: left;">
                                SLOT:</label>
                            <div class="system_id" align="center" style="padding-left: 10px; width: 100%">
                                @Html.TextBoxFor(model => model.slot_dslam, new { @name = "slot", @class = "input-medium" })
                                <font color="red">(*)</font>
                                <label style="width: 60%; text-align: left" >
                                  
                                  <font color="red">
                                   2/3/46/1-32 (ATM)<br />
 1.2.3.4.6 (IP)</font>
                                </label>
                                
                                <label style="width: 60%; text-align: left">
                                    @Html.ValidationMessageFor(model => model.slot_dslam)
                                </label>
                            </div>
                        </p>   
                        <p align="center">
                            <label style="width: 55%; text-align: left;">
                                Vlan:</label>
                            <div class="system_id" align="center" style="padding-left: 10px; width: 100%">
                                @Html.TextBoxFor(model => model.Vlan, new { @name = "Vlan", @class = "input-medium" })
                                <font color="red">(*)</font>
                                                                
                                <label style="width: 60%; text-align: left">
                                    @Html.ValidationMessageFor(model => model.Vlan)
                                </label>
                            </div>
                        </p>  
                        <p align="center">
                            <label style="width: 55%; text-align: left;">
                                IP:</label>
                            <div class="system_id" align="center" style="padding-left: 10px; width: 100%">
                                @Html.TextBoxFor(model => model.ip, new { @name = "ip", @class = "input-medium" })
                                <font color="red">(*)</font>
                                
                                
                                <label style="width: 60%; text-align: left">
                                    @Html.ValidationMessageFor(model => model.ip)
                                </label>
                            </div>
                        </p>    
                         <p align="center">
                            <label style="width: 55%; text-align: left;">
                                Thông Tin Người liên hệ:</label>
                            <div class="system_id" align="center" style="padding-left: 10px; width: 100%">
                                @Html.TextBoxFor(model => model.ttlienhe, new { @name = "ttlienhe", @class = "input-medium" })
                               <font color="red">(*)</font>
                                
                                
                                <label style="width: 60%; text-align: left">
                                    @Html.ValidationMessageFor(model => model.ip)
                                </label>
                            </div>
                             <p align="center">
                            <label style="width: 55%; text-align: left;">
                                Ghi Chú:</label>
                            <div class="system_id" align="center" style="padding-left: 10px; width: 100%">
                                @Html.TextBoxFor(model => model.ghichu, new { @name = "ghichu", @class = "input-medium" })
                                <font color="red">(*)</font>
                                
                                
                                <label style="width: 60%; text-align: left">
                                    @Html.ValidationMessageFor(model => model.ip)
                                </label>
                            </div>
                        </p>  
                       
                                                   
                        <p align="center">
                            <label style="width: 55%; text-align: left">
                                Trạng thái:</label>
                            <select name="status">
                                <option value="1" selected="selected">Bình thường</option>
                                <option value="0">Khóa</option>
                            </select>
                        </p>
                    </div>
                    <div class="button" align="center">
                        <p style="width: 25%; text-align: left;">
                            <input class="submit-green" type="submit" value="Thêm" />
                            <input class="submit-gray" type="reset" value="Hủy" />
                        </p>
                    </div>                    
                }
            </div>
            <!-- End .module-body -->
        </div>
        <!-- End .module -->
        <div style="clear: both;">
        </div>
    </div>
    <!-- End .grid_12 -->
    <div style="clear: both;">
    </div>
</div>
<!-- End .container_12 -->

<script type="text/javascript">
    $("#quan_huyen_id").change(function () {
        $.ajax({
            type: "POST",
            url: '@Url.Action("getKhuvucJson", "DslamPort")',
            data: { quan_huyen_id: $("#quan_huyen_id > option:selected").attr("value"), Order: "ten" },
            success: function (data) {
                var items = [];
                items.push("<option value=''>---Chọn Xã phường---</option>");
                $.each(data, function () {
                    items.push("<option value='" + this.Value + "'>" + this.Text + "</option>");
                });
                $("#xa_phuong_id").html(items.join(' '));
            }
        })
    });

    $("#xa_phuong_id").change(function () {
        $("#system_id").html("<option value=''>---Chọn Dslam---</option>");
        $.ajax({
            type: "POST",
            url: '@Url.Action("getTodanphoJson", "DslamPort")',
            data: { xa_phuong_id: $("#xa_phuong_id > option:selected").attr("value"), Order: "ten" },
            success: function (data) {
                var items = [];
                items.push("<option value=''>---Chọn Tổ dân phố---</option>");
                $.each(data, function () {
                    items.push("<option value='" + this.Value + "'>" + this.Text + "</option>");
                });
                $("#todanpho_id").html(items.join(' '));
            }
        })
    });
</script>